<%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@include file="taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Agenda Virtual</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
</head>
<body>
<f:view>
<h2>Agenda Virtual</h2>
<h:form id="agendaForm">
	<h:messages />
	<br />
	<h:commandLink value="Adicionar pessoa" id="addPessoa"
			actionListener="#{pessoaBean.preAddPessoa}" />
	<br />
	<div align="center">
		<c:if test="${not empty agendaBean.pessoas}">
			<table class="listagem">
				<caption>Pessoas cadastradas</caption>
				<thead>
					<tr>
						<td>id</td>
						<td>nome</td>
						<td></td>
						<td></td>
					</tr>
				</thead>
				<c:forEach items="#{agendaBean.pessoas}" var="pessoa">
					<tr>
						<td> <h:outputText value="#{pessoa.id}" /> </td>
						<td> <h:outputText value="#{pessoa.nome}" /> </td>
						<td>
							<h:commandLink value="Alterar" id="updatePessoa"
									actionListener="#{pessoaBean.preUpdatePessoa}">
								<f:param name="id" value="#{pessoa.id}" />
							</h:commandLink>
						</td>
						<td>
							<h:commandLink value="Remover" id="removePessoa"
									actionListener="#{pessoaBean.removePessoa}">
								<f:param name="id" value="#{pessoa.id}" />
							</h:commandLink>
						</td>
					</tr>
				</c:forEach>
			</table>
		</c:if>
	</div>
</h:form>
</f:view>
</body>
</html>